package tag25_13_08.ExamUndUnterricht;

import java.util.Scanner;

public class Ex12_ExamUncheckedException {

	public static void main(String[] args) {

		int var = 6;
		
		switch(var){
		case 1:
			String s = null;
			s.toLowerCase(); // java.lang.NullPointerException
		case 2:
			Throwable th  = new Error();
			Exception e = (Exception)th; //java.lang.ClassCastException
		case 3:
			int[] arr = {};
			System.out.println( arr[0] ); // java.lang.ArrayIndexOutOfBoundsException
		case 4:
			System.out.println(3./0);  // Infinity --> Keine Exception
			System.out.println( 3/0 ); // java.lang.ArithmeticException
			
		}
		
		
		// werden meintens von Entwicklern geworen:
		
		switch (var){
			case 5:
				throw new IllegalArgumentException();
			case 6:
				Scanner sc = new Scanner("1 2 3");
				//sc benutzen zum lesen
				sc.close();
				sc.next(); //java.lang.IllegalStateException -> cuando el Scanner esta cerrado
		
		
		}
		
	}// end of main

}
